<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
       let year=prompt("请输入出生年月份")
    let currentYear = new Date().getFullYear();
     let age=  currentYear-year;
       console.log(age) 
       alert(`你的年龄为${age}岁`)
       
    </script>a
</body>
</html>